package com.fish.anne;

import java.io.StringWriter;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;

 

 


/**
 * Constant values used throughout the application.
 * 
 *
 */
public class Constants {
    //~ Static fields/initializers =============================================

    
	public static final String FRONT_ERROR_MESSAGE="front_error_message";
	
    public static final String BUNDLE_KEY = "ApplicationResources";

    /**
     * File separator from System properties
     */
    public static final String FILE_SEP = System.getProperty("file.separator");

    /**
     * User home from System properties
     */
    public static final String USER_HOME = System.getProperty("user.home") + FILE_SEP;

    /**
     * The name of the configuration hashmap stored in application scope.
     */
    public static final String CONFIG = "appConfig";

    /**
     * Session scope attribute that holds the locale set by the user. By setting this key
     * to the same one that Struts uses, we get synchronization in Struts w/o having
     * to do extra work or have two session-level variables.
     */
    public static final String PREFERRED_LOCALE_KEY = "org.apache.struts2.action.LOCALE";

    

    /**
     * The request scope attribute for indicating a newly-registered user
     */
    public static final String REGISTERED = "registered";

    public static final String FORWARD = "forward";
    
    
    
  
    public static final String WEB_KEY = "hubaobei";

     
    
    
    public static final String COOKIES_GOODS_VIEW_HISTORY = "goods_view_history";
    
    public static final String COOKIES_USERNAME = "username";
    
 
    public static final String COOKIES_MALL_CART_GOODS = "mall_cart_goods";
    
    public static final String COOKIES_MALL_CART_PACKAGE= "mall_cart_package";
    
    public static final String COOKIES_MALL_CART_GIFT = "mall_cart_gift";
    
    public static final String COOKIES_MALL_CART_COUPON = "mall_cart_coupon";
    
    public static final String COOKIES_MALL_CART_NUM = "mall_cart_num";
    
    public static final String COOKIES_MARKET_MEMBER_FROM = "mall_market_member_from";
    
    public static final String COOKIES_MEMBER_FROM = "mall_member_from";
    
    public static final String MALL_CART_SPLIT = "--";
    
    public static final String MALL_CART_SPLIT_PRODUCT = "g";
    
    public static final String MALL_CART_SPLIT_PACKAGE = "p";
    
    
    public static final String VIEW_HISTORY_GOODS = "historyGoods";
    
    public static final Long DEFAULT_LONG = 0L;
    
    public static final Byte DEFAULT_BYTE = 0;
    
    public static final Short DEFAULT_SHORT = 0;
    
    public static final Integer DEFAULT_INTEGER = 0;
    
    public static final Double DEFAULT_DOUBLE = 0.0;
    
    
    public static final String DEFALT_STRING = " ";
    
    public static final String SPLIT_SYMBOL=",";
    
    public static final String URL_SPLIT_SYMBOL="$$$$$";
    
    public static final String SPLIT_SUB_SYMBOL="--";
    
    public static final String SPLIT_TYPE_PARAMETER_GROUP="___#___";
    
    public static final String SPLIT_TYPE_PARAMETER_GROUP_ITEM="__#__";
    
    public static final String SPLIT_TYPE_PARAMETER_GROUP_ITEM_ITEM="_#_";

	public static final Integer PAGER_PER_PAGE = 20;
	
	public static final String PAGER_PARA_NAME="pagerId";
	
	
	
	public static final Integer SELECTED_ATTR_BEGIN =1;
	public static final Integer INPUT_ATTR_BEGIN =21;
	
	
	
	public static final Long GOODS_DEFAULT_CAT_ID = DEFAULT_LONG;
	public static final Long GOODS_DEFAULT_BRAND_ID = DEFAULT_LONG;
	
	
	public static final BigDecimal DEFAULT_BIGDECIMAL = new BigDecimal(0);
	
	
	
	public static final String TMP_DIR = "/tmp/";
	
	

	
	
	
 	
	public static void main( String args[] )
    {
        /* first, we init the runtime engine.  Defaults are fine. */

        try
        {
            Velocity.init();
        }
        catch(Exception e)
        {
            System.out.println("Problem initializing Velocity : " + e );
            return;
        }

        /* lets make a Context and put data into it */

        VelocityContext context = new VelocityContext();

        context.put("name", "Velocity测试");
        context.put("project", "Jakarta");

        /* lets render a template */

        StringWriter w = new StringWriter();


        String s = "我是We are using $project $name to render this.";
        w = new StringWriter();

        try
        {
            Velocity.evaluate( context, w, "", s );
        }
        catch( ParseErrorException pee )
        {
            /*
             * thrown if something is wrong with the
             * syntax of our template string
             */
            System.out.println("ParseErrorException : " + pee );
        }
        catch( MethodInvocationException mee )
        {
            /*
             *  thrown if a method of a reference
             *  called by the template
             *  throws an exception. That won't happen here
             *  as we aren't calling any methods in this
             *  example, but we have to catch them anyway
             */
            System.out.println("MethodInvocationException : " + mee );
        }
        catch( Exception e )
        {
            System.out.println("Exception : " + e );
        }
        System.out.println(" string : " + w );
    }
}
